﻿@model IEnumerable<ESupervision.Models.ForumTopic>
@using Microsoft.AspNet.Identity;

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<br />

<p>
    @Html.ActionLink(" Create Topic", "Create", "ForumTopic", null, new { @class = "btn btn-info  glyphicon glyphicon-plus " })
    @*@Html.ActionLink("Create New", "Create")*@
</p>
<br />
<style>
    .hide {
        display: none;
    }
</style>
@foreach (var item in Model)
{
    <div class="panel panel-info">
        <div class="panel-heading">
            <h1 class="panel-title" id="panel-title">@Html.DisplayFor(modelItem => item.ForumTopicTitle)<a class="anchorjs-link" href="#panel-title"><span class="anchorjs-icon"></span></a></h1>
        </div>
        <div class="row" style=" padding: 10px 0px 5px 30px;">
            <div class="col-lg-10">
                <label style="color: #2fa4e7; font-size: medium">Posted by:@Html.DisplayFor(modelItem => item.ForumTopicPoster.FullName)</label>
                @Html.DisplayFor(modelItem => item.ForumTopicPostedTime)
            </div>
            <div class="col-lg-2">
                <a href="#">Comment <span class=" panel-title badge">@item.ForumReplies.Count</span></a> <a href="#"> View <span class=" panel-title badge">@item.ViewCount</span></a>
            </div>
        </div>
        <div class="row" style=" padding: 10px 0px 10px 30px;">
            <div class=" col-lg-11">
                <p>@Html.DisplayFor(modelItem => item.ForumTopicContent)</p>
            </div>
        </div>
        <div class="row" style=" padding: 5px 0px 15px 30px;">
            <div class="col-lg-5">
                @Html.ActionLink(" Readmore", "Details", "ForumTopic", new { id = item.ForumTopicID }, new { @class = "btn btn-success btn-sm  glyphicon glyphicon-chevron-right " })
                @{
    if (User.Identity.GetUserId() == item.ForumTopicPosterID)
    {
        @Html.ActionLink("Delete", "Delete", "ForumTopic", new { id = item.ForumTopicID }, new { @class = "btn btn-warning btn-sm  glyphicon glyphicon-remove " })
    }
    else
    {
        @Html.ActionLink("Delete", "Delete", "ForumTopic", new { id = item.ForumTopicID }, new { @class = "btn btn-warning btn-sm  glyphicon glyphicon-remove hide " })
    }
                }
            </div>

        </div>
    </div>
}
